package cn.edu.scau.cmi.wujiaxian.exercise4;

public class Max {
	public static void main(String[] args) {
		int sum = 0;
		int i, j, c;
		for (i = 1;; i++) {
			c = 1;
			for (j = i; j > 0; j--) {
				c = c * j;
			}
			sum = sum + c;
			if (sum >= 9876) {
				System.out.println("最大整数n是:" + i);
				break;
			}
		}
	}
}
